package com.example.sentinel.sentinel;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.example.sentinel.exception.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 限流的方法
 */
@Component
@Slf4j
public class MyFlowRule {

    /**
     * 被限流的方法
     * @return
     */
    public static R flowRuleWay(BlockException exception){
        log.error("进入限流方法啦");
        return R.error(-106, "流控异常");
    }
}
